package com.mrbug.pulltodismisspager.example;

import com.mrbug.pulltodismisspager.PullToDismissPager;

import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.app.Context;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

import org.junit.Test;

/**
 * 单元测试类
 */
public class PullToDismissPagerTest {
    private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "MY_TAG");
    private Context context;

    /**
     * 获取context
     */
    public void initClass() {
        context = AbilityDelegatorRegistry.getAbilityDelegator().getCurrentTopAbility().getContext();
    }

    /**
     * 添加pager
     */
    @Test
    public void getViewPager() {
        initClass();
        PullToDismissPager pullToDismissPager = new PullToDismissPager(context);
        pullToDismissPager.addView();
        if (pullToDismissPager.getViewPager() != null) {
            HiLog.info(LABEL, "successful");
        }
    }
}